package org.zachary.commonservice.service.impl;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.zachary.commonservice.entity.News;
import org.zachary.commonservice.entity.NewsDTO;
import org.zachary.commonservice.mapper.NewsMapper;
import org.zachary.commonservice.service.NewsService;

import java.util.List;

@Service
public class NewServiceImpl implements NewsService {
    @Resource
    private NewsMapper newsMapper;
    @Override
    public List<News> getAll() {
        return newsMapper.list();
    }

    @Override
    public void addNews(NewsDTO news) {
        newsMapper.add(news);
    }

    @Override
    public void deleteNews(Integer id) {
        newsMapper.delete(id);
    }

    @Override
    public void updateNews(News news) {
        newsMapper.update(news);
    }
}
